package com.zr.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.BaseDao;
import com.zr.model.User;
import com.zr.service.SearchUidService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service("searchuid")
public class SearchUidServiceImpl implements SearchUidService{
		
	@Resource 
	private BaseDao baseDao;
	
	
	@Override
	public JSONArray finduid() {
		JSONArray ja = new JSONArray();
		List<User> l = baseDao.find("from User where rid=8");
		for (User user : l) {
			JSONObject j = new JSONObject();
			j.put("id", user.getUid());
			j.put("text", user.getUid());
			ja.add(j);
		}
		return ja;
	}
	@Override
	public JSONArray finduids() {
		JSONArray ja = new JSONArray();
		List<User> l = baseDao.find("from User where rid=9");
		for (User user : l) {
			JSONObject j = new JSONObject();
			j.put("id", user.getUid());
			j.put("text", user.getUid());
			ja.add(j);
		}
		return ja;
	}

}
